package com.qfedu.controller;

import com.qfedu.entity.Collect;
import com.qfedu.service.CollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class CollectController {
    @Autowired
    private CollectService collectService;
    // 返回的指定用户ID收藏列表
    @RequestMapping("/collection/detail")
    @ResponseBody
    public List<Collect> findAllCollect(@RequestParam(value = "userId") int userId){
        System.out.println("userId = " + userId);
        List<Collect> allCollect = collectService.findAllCollect(userId);
        return allCollect;
    }

    @RequestMapping("/collection/delete")
    @ResponseBody
    public int deleteCollect(int userId,int songId){
        return collectService.deleteCollect(userId, songId);
    }



}
